var uid,user,name,avatar;
document.addEventListener('plusready', function() {	
	uid = plus.storage.getItem('uid');//用户id
	user = plus.storage.getItem('user');//登录手机号
	avatar = plus.storage.getItem('userAvatar') != null ? plus.storage.getItem('userAvatar') :'';
	name = plus.storage.getItem('name') != 'null'?plus.storage.getItem('name'):user;//用户名称
	ws = plus.webview.currentWebview();
	page = ws.page;
	console.log(avatar);
	//点击发布
	$('.set-up-wt').on('click',function(){
		var content = $(".content").val();
		console.log(content);
		if(!content.trim()){
			$(".content").val('');
			toast('没有信息无法发表！');return;
		}
		showWating();
		$.ajax({ 
			type:"get",
			url:apiRoot+'?m=Home&c=Bbs&a=setAdvice&uid='+uid+'&name='+name+'&content='+content,
			dataType:"json",
			success:function(data){
				if(data){
					plus.webview.getWebviewById(page).reload();
					plus.nativeUI.closeWaiting();
					setTimeout(function(){ 
						plus.webview.currentWebview().close();
					} , 2000); 
				}
			},
			error:function(e){
				console.log(JSON.stringify(e));
				errortoast();
			}
		});
	})
	
},false)